package com.zzj.until;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: TCH</p>
 * @author not attributable
 * @version 1.5.2
 */

public class EnOrDecode {
  public EnOrDecode() {
  };
  /**
   *
   * @param srcStr
   *  
   * @return
   *   
   *  
   */
  public static String Decode(String srcStr){
    if (srcStr.equalsIgnoreCase("")){
      return "";
    }
    byte[] bytes;
    try{
      bytes = new sun.misc.BASE64Decoder().decodeBuffer(srcStr);
      String hchh = new String(bytes);
      return hchh;
    }
    catch(Exception err){
      return "";
    }
  }

  /**
   *
   * @param srcStr
   *  
   * @return
   *    
   */

  public static String Encode(String srcStr){
    if (srcStr.equalsIgnoreCase("")){
      return "";
    }
    byte[] b=srcStr.getBytes();
    String decStr=new sun.misc.BASE64Encoder().encode(b);
    return decStr;
  }

//  public static void main(String[] args) {
//    EnOrDecode enOrDecode1 = new EnOrDecode();
//    String pass=enOrDecode1.Decode("YzE1Mw==");
//    System.out.println(pass);
//  }

}
